package com.riq;

import java.io.InputStream;

import java.net.URL;

import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import javax.activation.FileTypeMap;

import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;

public class MockServletContext implements ServletContext {
    
    private static final int MAJOR_SERVLET_VERSION = 2;
    private static final int MINOR_SERVLET_VERSION = 5;
    
    //contextPath
    private String contextPath;
    
    //Servlet contexts
    private final Map<String,ServletContext> servletContexts = 
        new HashMap <String,ServletContext> ();
    
    public MockServletContext() {
    }

    public String getContextPath() {
        return contextPath;
    }

    public ServletContext getContext(String context) {
        if (servletContexts.containsKey(context)) {
            return servletContexts.get(context);
        }
        return null;
    }

    public int getMajorVersion() {
        return MAJOR_SERVLET_VERSION;
    }

    public int getMinorVersion() {
        return MINOR_SERVLET_VERSION;
    }

    public String getMimeType(String file) {
        return FileTypeMap.getDefaultFileTypeMap().getContentType(file);
    }

    public Set getResourcePaths(String string) {
        return Collections.emptySet();
    }

    public URL getResource(String string) {
        return null;
    }

    public InputStream getResourceAsStream(String string) {
        return null;
    }

    public RequestDispatcher getRequestDispatcher(String string) {
        return null;
    }

    public RequestDispatcher getNamedDispatcher(String string) {
        return null;
    }
    
    @Deprecated
    public Servlet getServlet(String string) {
        return null;
    }
    
    @Deprecated
    public Enumeration getServlets() {
        return null;
    }
    
    @Deprecated
    public Enumeration getServletNames() {
        return null;
    }

    public void log(String string) {
    }
    
    @Deprecated
    public void log(Exception exception, String string) {
    }

    public void log(String string, Throwable throwable) {
    }

    public String getRealPath(String string) {
        return null;
    }

    public String getServerInfo() {
        return null;
    }

    public String getInitParameter(String string) {
        return null;
    }

    public Enumeration getInitParameterNames() {
        return null;
    }

    public Object getAttribute(String string) {
        return null;
    }

    public Enumeration getAttributeNames() {
        return null;
    }

    public void setAttribute(String string, Object object) {
    }

    public void removeAttribute(String string) {
    }

    public String getServletContextName() {
        return null;
    }
}